package com.example.barcodeapp.ui.wode.activity;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;
import android.view.View;

import com.example.barcodeapp.R;
import com.example.barcodeapp.base.BaseActivity;
import com.example.barcodeapp.base.BaseAdapter;
import com.example.barcodeapp.interfaces.IBasePersenter;
import com.example.barcodeapp.ui.wode.adapter.ChongZhiAdapter;
import com.example.barcodeapp.ui.wode.bean.ChongZhiBean;

import java.util.ArrayList;

public class ChongZhiActivity extends BaseActivity {

    private RecyclerView mRecChongZhi;
    private ArrayList<ChongZhiBean> chongZhiBeans;
    private ChongZhiAdapter chongZhiAdapter;

    @Override
    protected int getLayout() {
        return R.layout.activity_chong_zhi;
    }

    @Override
    protected void initView() {
        mRecChongZhi = findViewById(R.id.rec_chongzhi);
        chongZhiBeans = new ArrayList<>();
        chongZhiBeans.add(new ChongZhiBean("6", "18", true));
        chongZhiBeans.add(new ChongZhiBean("6", "18", false));
        chongZhiBeans.add(new ChongZhiBean("6", "18", false));
        chongZhiBeans.add(new ChongZhiBean("6", "18", false));
        chongZhiBeans.add(new ChongZhiBean("6", "18", false));
        chongZhiBeans.add(new ChongZhiBean("6", "18", false));
        chongZhiBeans.add(new ChongZhiBean("6", "18", false));
        chongZhiBeans.add(new ChongZhiBean("6", "18", false));
        chongZhiBeans.add(new ChongZhiBean("6", "18", false));
        mRecChongZhi.setLayoutManager(new GridLayoutManager(ChongZhiActivity.this, 3));
        chongZhiAdapter = new ChongZhiAdapter(ChongZhiActivity.this, chongZhiBeans);
        chongZhiAdapter.notifyDataSetChanged();
        chongZhiAdapter.setClick(new BaseAdapter.IClick() {
            @Override
            public void click(int pos) {
                for (int i = 0; i < chongZhiBeans.size(); i++) {
                    chongZhiBeans.get(i).setSelect(false);
                }
                chongZhiBeans.get(pos).setSelect(true);
            }
        });
    }

    @Override
    protected IBasePersenter initPersenter() {
        return null;
    }

    @Override
    protected void initData() {

    }
}